package br.com.fafica.fast_restaurant.view;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import javax.swing.JSeparator;
import javax.swing.JLabel;
import javax.swing.ImageIcon;

public class TelaPesquisar extends JFrame {

	private JPanel contentPane;

			public void run() {
				try {
					TelaPesquisar frame = new TelaPesquisar();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}

	public TelaPesquisar() {
		
		final TelaPesquisar estaTela = this;
		setTitle("PESQUISAR");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 800, 600);
		contentPane = new JPanel();
		contentPane.setBackground(new Color(255, 255, 255));
		contentPane.setToolTipText("");
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		JPanel panel = new JPanel();
		panel.setBackground(new Color(255, 255, 255));
		
		JButton btnFuncionrio = new JButton("Funcion\u00E1rio");
		btnFuncionrio.setForeground(new Color(255, 215, 0));
		btnFuncionrio.setBackground(new Color(0, 100, 0));
		btnFuncionrio.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				TelaPesquisarFuncionario telaPesquisarFuncionario= new TelaPesquisarFuncionario();
				telaPesquisarFuncionario.setVisible(true);
				estaTela.setVisible(false);
				
			}
		});
		
		JSeparator separator = new JSeparator();
		
		JLabel lblNewLabel = new JLabel("New label");
		lblNewLabel.setIcon(new ImageIcon(TelaPesquisar.class.getResource("/ICONES_WALLPAPERS/SLOGAN_FINAL.jpg")));
		GroupLayout gl_contentPane = new GroupLayout(contentPane);
		gl_contentPane.setHorizontalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING, false)
							.addComponent(separator, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
							.addComponent(lblNewLabel, Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 776, Short.MAX_VALUE))
						.addComponent(panel, GroupLayout.PREFERRED_SIZE, 765, GroupLayout.PREFERRED_SIZE))
					.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
		);
		gl_contentPane.setVerticalGroup(
			gl_contentPane.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_contentPane.createSequentialGroup()
					.addComponent(panel, GroupLayout.PREFERRED_SIZE, 45, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(separator, GroupLayout.PREFERRED_SIZE, 7, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 476, Short.MAX_VALUE)
					.addContainerGap())
		);
		
		JButton btnCliente = new JButton("Cliente");
		btnCliente.setForeground(new Color(255, 215, 0));
		btnCliente.setBackground(new Color(0, 100, 0));
		btnCliente.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				
				TelaPesquisarCliente telaPesquisarCliente = new TelaPesquisarCliente();
				telaPesquisarCliente.setVisible(true);
				estaTela.setVisible(false);
			}
		});
		
		JButton btnNewButton = new JButton("Mesa");
		btnNewButton.setForeground(new Color(255, 215, 0));
		btnNewButton.setBackground(new Color(0, 100, 0));
		btnNewButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				TelaPesquisarMesa telaPesquisarMesa= new TelaPesquisarMesa();
				telaPesquisarMesa.setVisible(true);
				estaTela.setVisible(false);
			}
		});
		
		JButton btnProduto = new JButton("Produto");
		btnProduto.setForeground(new Color(255, 215, 0));
		btnProduto.setBackground(new Color(0, 100, 0));
		btnProduto.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				TelaPesquisarProduto telaPesquisarProduto = new TelaPesquisarProduto();
				telaPesquisarProduto.setVisible(true);
				estaTela.setVisible(false);
			}
		});
		
		JButton btnSair = new JButton("Sair");
		btnSair.setForeground(new Color(255, 215, 0));
		btnSair.setBackground(new Color(0, 100, 0));
		btnSair.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				
				estaTela.dispose();
				TelaPrincipal telaPrincipal = new TelaPrincipal();
				telaPrincipal.setVisible(true);
				
			}
		});
		GroupLayout gl_panel = new GroupLayout(panel);
		gl_panel.setHorizontalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel.createSequentialGroup()
					.addComponent(btnFuncionrio)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(btnCliente, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(btnNewButton, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(btnProduto)
					.addPreferredGap(ComponentPlacement.RELATED, 348, Short.MAX_VALUE)
					.addComponent(btnSair, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)
					.addContainerGap())
		);
		gl_panel.setVerticalGroup(
			gl_panel.createParallelGroup(Alignment.LEADING)
				.addComponent(btnFuncionrio, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
				.addComponent(btnCliente, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
				.addComponent(btnNewButton, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
				.addComponent(btnProduto, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
				.addComponent(btnSair, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
		);
		panel.setLayout(gl_panel);
		contentPane.setLayout(gl_contentPane);
	}
}
